CFLAGS = -Wall -c

all:main.exe

main.exe: main.o menu.o area.o mouse_manip.o font.o sprite.o song_manip.o rtc.o GQueue.o rtc_asm.o music.o video.o codepage.o kbc.o queue.o timer.o ints.o ints_asm.o kbd_isr.o wait.o mouse_isr.o
	gcc main.o mouse_isr.o kbd_isr.o wait.o rtc_asm.o liblcom.a -o main.exe

main.o: main.c menu.o kbc.h kbc.c queue.h queue.c
	gcc $(CFLAGS) main.c

menu.o: menu.c
	gcc $(CFLAGS) menu.c
	ar r liblcom.a menu.o

area.o: area.c
	gcc $(CFLAGS) area.c
	ar r liblcom.a area.o
	
mouse_manip.o: mouse_manip.c
	gcc $(CFLAGS) mouse_manip.c
	ar r liblcom.a mouse_manip.o
	
font.o: font.c
	gcc $(CFLAGS) font.c
	ar r liblcom.a font.o

sprite.o: sprite.c
	gcc $(CFLAGS) sprite.c
	ar r liblcom.a sprite.o

song_manip.o: song_manip.c
	gcc $(CFLAGS) song_manip.c
	ar r liblcom.a song_manip.o
	
rtc.o: rtc.c
	gcc $(CFLAGS) rtc.c
	ar r liblcom.a rtc.o
	
GQueue.o: GQueue.c
	gcc $(CFLAGS) GQueue.c
	ar r liblcom.a GQueue.o
	
music.o: music.c
	gcc $(CFLAGS) music.c
	ar r liblcom.a music.o
	
video.o: video.c
	gcc $(CFLAGS) video.c
	ar r liblcom.a video.o

codepage.o: codepage.c
	gcc $(CFLAGS) codepage.c
	ar r liblcom.a codepage.o
	
kbc.o: kbc.c
	gcc $(CFLAGS) kbc.c
	ar r liblcom.a kbc.o

queue.o: queue.c
	gcc $(CFLAGS) queue.c
	ar r liblcom.a queue.o

wait.o: wait.asm
	nasm -t -f coff wait.asm -o wait.o
	
kbd_isr.o: kbd_isr.asm
	nasm -t -f coff kbd_isr.asm -o kbd_isr.o

timer.o: timer.c
	gcc $(CFLAGS) timer.c
	ar r liblcom.a timer.o

ints.o: ints.c
	gcc $(CFLAGS) ints.c
	ar r liblcom.a ints.o

ints_asm.o: ints_asm.asm
	nasm -t -f coff ints_asm.asm -o ints_asm.o
	ar r liblcom.a ints_asm.o
	
rtc_asm.o: rtc_asm.asm
	nasm -t -f coff rtc_asm.asm -o rtc_asm.o
	ar r liblcom.a rtc_asm.o
	
mouse_isr.o: mouse_isr.asm
	nasm -t -f coff mouse_isr.asm -o mouse_isr.o
	ar r liblcom.a mouse_isr.o
	


clean:
	rm *.o *.exe
